package com.bo.threadState;

/**
 * @Author: gpb
 * @Date: 2024/7/13 22:36
 * @Description:
 */
public class WAITING {
    public static void main(String[] args) throws InterruptedException {
        Object lock = new Object();
        Thread thread = new Thread(() -> {
            synchronized (lock) {
                try {
                    lock.wait();
                } catch (InterruptedException e) {
                }
            }
        });
        thread.start();
        Thread.sleep(500);
        System.out.println(thread.getState());
        Thread.sleep(500);
        synchronized (lock) {
            lock.notify();
            Thread.sleep(500);
            System.out.println(thread.getState());
        }
    }
}
